-- Start of DDL Script for Table BRIDGE.IMPORT_OBJECT_TYPE
-- Generated 18.09.2013 12:23:07 from BRIDGE@lcnp

CREATE TABLE bridge.import_object_type
    (id                             NUMBER NOT NULL,
    tag                            VARCHAR2(30) NOT NULL,
    object_type                    VARCHAR2(30) NOT NULL,
    note                           VARCHAR2(4000),
    type_of_use                    NUMBER DEFAULT 0 NOT NULL
  ,
  CONSTRAINT XPKIMPORT_OBJECT_TYPE
  PRIMARY KEY (id)
  USING INDEX
  TABLESPACE  users)
  TABLESPACE  users
/





-- Indexes for BRIDGE.IMPORT_OBJECT_TYPE

CREATE INDEX bridge.xie1import_object_type ON bridge.import_object_type
  (
    object_type                     ASC
  )
  TABLESPACE  users
/



-- Constraints for BRIDGE.IMPORT_OBJECT_TYPE

ALTER TABLE bridge.import_object_type
ADD CONSTRAINT object_type_ck1 CHECK (object_type in ('TRIGGER','PROCEDURE','JOB','PACKAGE','TABLE','SEQUENCE','SCHEDULE','VIEW','FUNCTION'))
/

ALTER TABLE bridge.import_object_type
ADD CONSTRAINT xak1import_object_type UNIQUE (tag)
USING INDEX
  TABLESPACE  users
/


-- Triggers for BRIDGE.IMPORT_OBJECT_TYPE

CREATE TRIGGER "BRIDGE".import_object_type_BI_TRG
 BEFORE 
 INSERT
 ON bridge.import_object_type
 REFERENCING OLD AS OLD NEW AS NEW
 FOR EACH ROW
BEGIN
   IF :NEW.ID IS NULL OR :NEW.ID = 0
   THEN
      SELECT bridge.SQ_import_object_type.NEXTVAL
        INTO :NEW.ID
        FROM DUAL;
   END IF;
END;
/


-- Comments for BRIDGE.IMPORT_OBJECT_TYPE

COMMENT ON COLUMN bridge.import_object_type.id IS 'Primary key import_object_type_id'
/
COMMENT ON COLUMN bridge.import_object_type.note IS 'Comment'
/
COMMENT ON COLUMN bridge.import_object_type.object_type IS 'Oracle object type'
/
COMMENT ON COLUMN bridge.import_object_type.tag IS 'Unique type name'
/

-- End of DDL Script for Table BRIDGE.IMPORT_OBJECT_TYPE

